using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

namespace HamcoWcs.Entitys.MainTaskBaks
{
    public class MainTaskBakConfig : IEntityTypeConfiguration<MainTaskBak>
    {
        public void Configure(EntityTypeBuilder<MainTaskBak> builder)
        {
            builder.HasComment("主任务备份表");
            builder.Property(x => x.Sender).IsRequired().HasMaxLength(30).HasComment("发送方：WMS/WCS/MES...");
            builder.Property(x => x.TaskId).IsRequired().HasMaxLength(50).HasComment("任务号");
            //builder.Property(x => x.FromLoc).HasMaxLength(30).HasComment("起点");
            //builder.Property(x => x.ToLoc).HasMaxLength(30).HasComment("终点");
            builder.Property(x => x.UnitId).IsRequired().HasMaxLength(100).HasComment("条码号");
            builder.Property(x => x.Priority).IsRequired().HasComment("优先级");
            builder.Property(x => x.Extend).HasColumnType("text").HasComment("扩展");
            builder.Property(x => x.ReasonCode).HasComment("异常区分");
            builder.Property(x => x.MainTaskType).IsRequired().HasMaxLength(30).HasComment("主任务类型");
            builder.Property(x => x.ActiveSubTaskId).IsRequired().HasComment("正在执行的子任务");
            builder.Property(x => x.TotalSubTaskNum).IsRequired().HasComment("子任务总数");
            builder.Property(x => x.TaskStatus).IsRequired().HasMaxLength(30).HasComment("任务状态");

            //================================================

            builder.Property(x => x.SrcMachine).HasMaxLength(15).HasDefaultValue("").HasComment("起始地设备名");
            builder.Property(x => x.SrcPosition).HasMaxLength(10).HasDefaultValue("").HasComment("起始地位置");
            builder.Property(x => x.SrcType).HasMaxLength(10).HasDefaultValue("").HasComment("起始地类型");
            builder.Property(x => x.SrcZone).HasMaxLength(15).HasDefaultValue("").HasComment("起始地区域");
            builder.Property(x => x.DesMachine).HasMaxLength(15).HasDefaultValue("").HasComment("目的地设备名");
            builder.Property(x => x.DesPosition).HasMaxLength(10).HasDefaultValue("").HasComment("目的地位置");
            builder.Property(x => x.DesType).HasMaxLength(10).HasDefaultValue("").HasComment("目的地类型");
            builder.Property(x => x.DesZone).HasMaxLength(15).HasDefaultValue("").HasComment("目的地区域");
            builder.Property(x => x.CurrentMachine).HasMaxLength(15).HasDefaultValue("").HasComment("当前设备");
            builder.Property(x => x.CurrentPosition).HasMaxLength(10).HasDefaultValue("").HasComment("当前位置");
            builder.Property(x => x.CurrentType).HasMaxLength(10).HasDefaultValue("").HasComment("当前设备类型");
            builder.Property(x => x.CurrentZone).HasMaxLength(15).HasDefaultValue("").HasComment("当前区域");
            builder.Property(x => x.OldDesMachine).HasMaxLength(15).HasDefaultValue("").HasComment("旧目的地设备名");
            builder.Property(x => x.OldDesPosition).HasMaxLength(10).HasDefaultValue("").HasComment("旧目的地位置");
            builder.Property(x => x.OldDesType).HasMaxLength(10).HasDefaultValue("").HasComment("旧目的地类型");
            builder.Property(x => x.OldDesZone).HasMaxLength(15).HasDefaultValue("").HasComment("旧目的地区域");
            builder.Property(x => x.SrcPriority).HasDefaultValue(0).HasComment("起始地优先级");
            builder.Property(x => x.DesPriority).HasDefaultValue(0).HasComment("目的地优先级");

            builder.Property(x => x.ReadyTime).HasDefaultValue().HasComment("准备完成时间");
            builder.Property(x => x.StartTime).HasDefaultValue().HasComment("开始时间");
            builder.Property(x => x.CompleteTime).HasDefaultValue().HasComment("完成时间");
            builder.Property(x => x.LastPriorityUpdateTime).HasDefaultValue().HasComment("上次更新优先级的时间");
            builder.Property(x => x.IsReportStart).HasDefaultValue(0).HasComment("是否向MES上报开始，0未上报，1已上报");
            builder.Property(x => x.IsTimeout).HasDefaultValue(0).HasComment("是否超时");
            builder.Property(x => x.TransactionId).HasDefaultValue().HasMaxLength(50).HasComment("MES下发任务是的TransactionId");
            builder.Property(x => x.Path).HasDefaultValue().HasMaxLength(200).HasComment("路径");
            builder.Property(x => x.MaterialInfo).HasDefaultValue().HasColumnType("text").HasComment("物料信息");
            builder.Property(x => x.InventoryInfo).HasDefaultValue().HasColumnType("text").HasComment("盘点信息");
            //================================================


        }
    }
}